package com.example.myapplication.stepFragment;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;

import com.example.myapplication.R;
import com.example.myapplication.view.CountDownProgressBar;


public class StepReadFragment8 extends Fragment {

    private CountDownProgressBar cpb_countdown;
    View view;

    public StepReadFragment8() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment_step_read8, container, false);


        Button btn_start = view.findViewById(R.id.btn_start);
        cpb_countdown = (CountDownProgressBar) view.findViewById(R.id.cpb_countdown);
        btn_start.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                btn_start.setAlpha(0);
                btn_start.setClickable(false);
                cpb_countdown.setDuration(30000, new CountDownProgressBar.OnFinishListener() {
                    @Override
                    public void onFinish() {
                        Toast.makeText(getActivity(), "完成了", Toast.LENGTH_SHORT).show();
                    }
                });
            }
        });


        return view;
    }
}